<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <title>基本资料</title>

    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/custom.ui.jqgrid.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/style.css" rel="stylesheet">

    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery.form.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/common.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/minified/jquery.jqGrid.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/js/global.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
	<script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>

    <style type="text/css">
        .main h5 a {
            position: absolute;
            right: 20px;
            font-size: 14px;
            bottom: 0px;
            display: inline-block;
            padding: 5px;
        }
        .right{
        	*+padding-top:110px;
        }
        .table_list tbody tr {
            height: 35px;
            text-align: center;
        }
        .l{
		   width: 100%;
		  *+width:80%;
		   height: 1px;
		   background: #000;
		   display: block;
		   float: left;
		   margin-top: 16px;
		   margin-bottom: 10px;
		  *+margin-left:240px;
		}
		.lable{
			font-size: 16px;
			width: 10%;
			float:left;
		}
		.h1{
			margin-top: 0px;
			width: 80%;
    		font-size: 20px !important;
		}
		.left ul li a, .left ul li a:hover{
			*+color:#fff;
		}
		.left li{
			*+padding:0px 20px 10px;
			
			*+line-height:38px;
		}
		.col-sm-12,.line{
			*margin-left:270px;
		}
		.lt{
			float:left;
		}
		.input-group  a{
			display:inline-block\9;
			*+display:inline-block;
			width:52px\9;
			*+width:30px;
			height:34px\9;
			*+height:26px;
			*+line-height:26px;
			position:absolute\9;
		}
		.input-group .form-control{
			width:626px\9;
			*+width:586px;
		}
		.form-control{
			*height:26px;
			*line-height:26px;
			width:680px\9;
			*width:640px;
		}
		
		.form-group{
			overflow: hidden\9;
			*overflow: hidden;
		}
		.control-label{
			width:150px\9;
			*width:70px;
			text-align:right\9;
			*text-align:right;
			*height:26px;
			*line-height:26px;
			display:inline-block\9;
			*display:inline-block;
		}
		.form-horizontal{
			padding-left:150px\9;
			*padding-left:150px;
		}
		.input-group{
			width:70px\9;
		}
		
		#sub{
			*+line-height:10px;
		}
    </style>
</head>
<body view="menu-item-4142">
<jsp:include page="../../top.jsp"></jsp:include>
<div class="right">
	<div style="*+margin-left:270px;">
		<div>
			<c:if test="${rLevel != 4}">
		        <div>
		            <label class="lable ">审核状态:</label>
		            <div class="">
		                <h1 class="h1">
		                <c:if test="${tCommunity.status == 0}">审核中</c:if>
		                <c:if test="${tCommunity.status == 1}">审核通过</c:if>
		                <c:if test="${tCommunity.status == 2}">审核拒绝</c:if>
		                <c:if test="${tCommunity.status == 3}">候审</c:if>
		                </h1>
		            </div>
		        </div>
		        <div>
		        <c:if test="${tCommunity.status != 1}">
		           <label class="lable">备注说明:</label>
		           <div class="">
		                <h1 class="h1">
		                	<c:if test="${tCommunity.status == 0}">您的申请已提交；工作人员将在收到申请的一个工作日内完成审核。</c:if>
		                	<c:if test="${tCommunity.status == 2 || tCommunity.status == 3}">
		                		<c:if test="${empty tCommunity.comm}">无</c:if>
			                	<c:if test="${not empty tCommunity.comm}">${tCommunity.comm}</c:if>
			                </c:if>
		                </h1>
		            </div>
		        </c:if>
		        </div>
			</c:if>
			</div>
	</div>
	<div class="l"></div>
	<div class="jqGrid_wrapper">
		<div class="col-sm-12">
		    <form class="form-horizontal m-t" id="uploadForm">
		        <input type="hidden" name="sid" id="sid" value="${tCommunity.sid}">
		    	<div class="form-group">
		            <label class="col-sm-3  control-label lt">公司名称:</label>
		            <div class="col-sm-8 lt">
		                <input class="form-control" name="agtName" id="agtName" size="30" value="${agtName}" disabled="disabled"/>
		            </div>
		        </div>
		        <input class="form-control lt" name="agtcode" id="agtcode" size="30" disabled="disabled" style="display: none;"/>
		        <div class="form-group">
		            <c:if test="${rLevel == 4}">
		            	<label class="col-sm-3  control-label lt">登录账号:</label>
		            </c:if>
		            <c:if test="${rLevel != 4}">
		            	<label class="col-sm-3  control-label lt">小区账号:</label>
		            </c:if>
		            <div class="col-sm-8 lt">
		                <input class="form-control" size="30" disabled="disabled" name="adminUserName" id="adminUserName"  value="${tCommunity.username}"/>
		            </div>
		        </div>
		        <div class="form-group">
		            <label class="col-sm-3 lt  control-label">密码:</label>
		            <div class="col-sm-8 lt">
		                <div class="input-group">
		                    <input class="form-control" type="password" readonly size="30" value="******"/>
		                    <a class="input-group-addon btn btn-primary" href="javascript:void(0);">修改</a>
		                </div>
		            </div>
		         </div>
		        <div class="form-group">
		        	<c:if test="${rLevel == 4}">
			            <label class="col-sm-3 lt  control-label"><i class="require">*</i>客户名称:</label>
		            </c:if>
		            <c:if test="${rLevel != 4}">
			            <label class="col-sm-3  lt control-label"><i class="require">*</i>小区名称:</label>
		            </c:if>
		            <div class="col-sm-8 lt">
		                <input class="form-control" name="communityName" id="communityName" size="30" value="${tCommunity.communityName}" />
		            </div>
		        </div>
		        <div class="form-group">
			        <label class="col-sm-3  lt control-label"><i class="require">*</i>联系人:</label>
			        <div class="col-sm-8  lt">
			            <input class="form-control" name="comContact" id="comContact"size="30" value="${tCommunity.comContact}"/>
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 lt control-label"><i class="require">*</i>联系方式:</label>
			        <div class="col-sm-8 lt">
			            <input class="form-control" name="departTel" id="departTel"size="30" value="${tCommunity.departTel}" />
			
			        </div>
			    </div>
		        <div class="form-group">
		        <label class="col-sm-3 control-label lt"><i class="require">*</i>所属区域:</label>
	        	<div class="col-sm-8 lt" id="region">
	            	<input type="hidden" name="region" value="${tCommunity.areaCode}">
	            	<div class="input-group">
		                <input class="form-control lt" readonly size="30"
		                       value="${tCommunity.cityCode }"/>
		                <a class="input-group-addon btn btn-primary" onclick="loadRegions();">修改</a>
	            	</div>
	        	</div>
	        </div>
		       <div class="form-group">
		            <c:if test="${rLevel == 4}">
		            	<label class="col-sm-3  lt control-label">详细地址:</label>
		            </c:if>
		            <c:if test="${rLevel != 4}">
		            	<label class="col-sm-3  lt control-label">小区详细地址:</label>
		            </c:if>
		            
		            <div class="col-sm-8 lt">
		                <input class="form-control" name="street" id="street" size="30" value="${tCommunity.street}"/>
		            </div>
		        </div>
		        <div style="text-align: center;">
		             <input class="btn btn-success form-control"  type="button" id="sub" onclick="checkTail()"  style="width: 150px;" value="提交">
		        </div>
		 </form>
		</div>
	</div>
</div>
<script type="text/javascript">
$(".input-group-addon").click(function () {
    var $input = $(this).prev();
    $input.removeAttr("readonly");
    $input.attr("name", "password");
    $input.attr("id", "password");
    $input.val("");
});
function checkTail(){
	$("#sub").attr("disabled", "true");
	var sid = $("#sid").val();
	var adminUserName = $("#adminUserName").val();
    var password = $("#password").val();
    var communityName = $("#communityName").val();
    var comContact = $("#comContact").val();
    var departTel = $("#departTel").val();
    var cityCode = $("#cityCode").val();
    var areaCode;
    if(typeof(cityCode) != "undefined"){
	    var selects=document.getElementsByName('areaCode');
	    areaCode = selects[0].value;
    }
    var street = $("#street").val();
    if(!communityName){
		if('${rLevel}'==4){
	   	  alert("客户名称必填");
		}else{
	   	  alert("小区名称必填");
		}
    	 $("#sub").removeAttr("disabled");
    	 return;
    }
    if(!comContact){
    	 alert("联系人姓名必填");
    	 $("#sub").removeAttr("disabled");
    	 return;
    }
    if(!departTel){
    	 alert("联系方式必填");
    	 $("#sub").removeAttr("disabled");
    	 return;
    }
    if(typeof(cityCode) != "undefined" && !areaCode){
    	 alert("所属区域必填");
    	 $("#sub").removeAttr("disabled");
    	 return;
    }
    $.post("${pageContext.request.contextPath}/admin/tcommunity_update.action", {
        'sid':sid,
        'adminUserName':adminUserName,
	    'password': password,
	    'communityName': communityName,
	    'comContact': comContact,
	    'departTel': departTel,
        'areaCode': areaCode,
        'cityCode':cityCode,
	    'street': street
     }, function (result) {
         result = JSON.parse(result)
         if (result.code == 1) {
        	 layer.alert(result.msg);
        	 $("#sub").removeAttr("disabled");
         }else{
        	 $("#sub").removeAttr("disabled");
         	layer.alert(result.msg);
         }
     });
}
</script>
</body>
</html>
